package com.slz3.business.module.memberManagement.Feedback.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.memberManagement.Feedback.domain.Feedback;
import com.slz3.business.module.memberManagement.Feedback.domain.FeedbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class FeedbackTransactionalServiceImpl implements FeedbackTransactionalService {

    @Override
    public Feedback modify(Feedback FeedbackNew) {
        Repositorys.feedback.test();
        Repositorys.feedback.save(FeedbackFactory.initBaseFields());
        System.err.println(1/0);
        FeedbackNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.feedback.saveAndFlush(FeedbackNew);
    }

    @Override
    public List<Feedback> batchModify(List<Feedback> FeedbackList) {
        return Repositorys.feedback.saveAll(FeedbackList);
    }
}
